require(estimatr)
require(MASS)
require(permuco)

#### loading data ####
supply.data <- read.csv("supply_side_data.csv")
nrow(supply.data)

supply.data$mid.edu <- (supply.data$education > 2 & supply.data$education < 6) * 1
supply.data$high.edu <- (supply.data$education > 5) * 1
supply.data$LDP.supporter <- (supply.data$partisanship == 1) * 1
supply.data$other.supporter <- (supply.data$partisanship > 1 & supply.data$partisanship < 10) * 1
supply.data$independent <- (supply.data$partisanship > 9) * 1

#### census distribution ####
census.age.gender <- read.csv("census_age_gender.csv")
census.prefecture.age <- read.csv("census_prefecture_age.csv")

## Table A.7 (gender)
# survey
round(prop.table(table(supply.data$female)), 3)
# census
round(prop.table(colSums(census.age.gender[, c("male", "female")])), 3)

## Table A.7 (age)
# survey
round(prop.table(c(sum(supply.data$age < 30), 
                   sum(supply.data$age >= 30 & supply.data$age < 40), 
                   sum(supply.data$age >= 40 & supply.data$age < 50), 
                   sum(supply.data$age >= 50 & supply.data$age < 60), 
                   sum(supply.data$age >= 60 & supply.data$age < 70), 
                   sum(supply.data$age >= 70))), 3)
# census
round(prop.table(c(sum(census.age.gender[census.age.gender$age >= 18 & 
                                           census.age.gender$age < 30, -1]), 
                   sum(census.age.gender[census.age.gender$age >= 30 & 
                                           census.age.gender$age < 40, -1]), 
                   sum(census.age.gender[census.age.gender$age >= 40 & 
                                           census.age.gender$age < 50, -1]), 
                   sum(census.age.gender[census.age.gender$age >= 50 & 
                                           census.age.gender$age < 60, -1]), 
                   sum(census.age.gender[census.age.gender$age >= 60 & 
                                           census.age.gender$age < 70, -1]), 
                   sum(census.age.gender[census.age.gender$age >= 70, -1]))), 3)

## Table A.7 (region of residence)
# survey
round(prop.table(c(sum(supply.data$prefecture == 1), 
                   sum(supply.data$prefecture >= 2 & 
                         supply.data$prefecture < 8), 
                   sum(supply.data$prefecture >= 8 & 
                         supply.data$prefecture < 15), 
                   sum(supply.data$prefecture >= 15 & 
                         supply.data$prefecture < 24), 
                   sum(supply.data$prefecture >= 24 & 
                         supply.data$prefecture < 31), 
                   sum(supply.data$prefecture >= 31 & 
                         supply.data$prefecture < 36), 
                   sum(supply.data$prefecture >= 36 & 
                         supply.data$prefecture < 40), 
                   sum(supply.data$prefecture >= 40))), 3)
# census
round(prop.table(c(sum(census.prefecture.age[census.prefecture.age$prefecture == 
                                               "Hokkaido", -1]), 
                   sum(census.prefecture.age[census.prefecture.age$prefecture %in%  
                                               c("Aomori", "Iwate", "Miyagi", 
                                                 "Akita", "Yamagata", "Fukushima"), -1]), 
                   sum(census.prefecture.age[census.prefecture.age$prefecture %in% 
                                               c("Ibaraki", "Tochigi", "Gunma", 
                                                 "Saitama", "Chiba", "Tokyo", 
                                                 "Kanagawa"), -1]), 
                   sum(census.prefecture.age[census.prefecture.age$prefecture %in% 
                                               c("Niigata", "Toyama", "Ishikawa", 
                                                 "Fukui", "Yamanashi", "Nagano", 
                                                 "Gifu", "Shizuoka", "Aichi"), -1]), 
                   sum(census.prefecture.age[census.prefecture.age$prefecture %in% 
                                               c("Mie", "Shiga", "Kyoto", 
                                                 "Osaka", "Hyogo", "Nara", 
                                                 "Wakayama"), -1]), 
                   sum(census.prefecture.age[census.prefecture.age$prefecture %in% 
                                               c("Tottori", "Shimane", "Okayama", 
                                                 "Hiroshima", "Yamaguchi"), -1]), 
                   sum(census.prefecture.age[census.prefecture.age$prefecture %in% 
                                               c("Tokushima", "Kagawa", "Ehime", 
                                                 "Kochi"), -1]), 
                   sum(census.prefecture.age[census.prefecture.age$prefecture %in% 
                                               c("Fukuoka", "Saga", "Nagasaki", 
                                                 "Kumamoto", "Oita", "Miyazaki", 
                                                 "Kagoshima", "Okinawa"), -1]))), 3)

#### equivalence tests of pretreatment covariates ####
equivalence.F.test <- function (data,  # data frame containing variables
                                variable,  # variable to be tested
                                group,  # group variable
                                epsilon  # equivalence limits
) {
  variable.comp <- na.omit(data[, variable])
  group.comp <- data[! is.na(data[, variable]), group]
  N <- length(variable.comp)
  k <- length(unique(group.comp))
  n <- table(group.comp)
  n.bar <- mean(n)
  grand.mean <- mean(variable.comp)
  group.mean <- tapply(variable.comp, group.comp, mean)
  SS.between <- 0
  SS.within <- rep(NA, k)
  for (i in 1:k) {
    SS.between <- SS.between + 
      (n[i] / n.bar) * (group.mean[i] - grand.mean) ^ 2
    SS.within[i] <- sum((variable.comp[group.comp == i] - group.mean[i]) ^ 2)
  }
  psi.sq.hat <- SS.between / 
    (sum(SS.within) / (N - k))
  noncentrality.par <- n.bar * epsilon ^ 2
  p.value <- pf(psi.sq.hat / ((k - 1) / n.bar), k - 1, N - k, noncentrality.par)
  result <- data.frame(matrix(round(group.mean, 2), 1, k), p = round(p.value, 3))
  rownames(result) <- variable
  result
}

equivalence.F.test.result <- 
  rbind(equivalence.F.test(supply.data, "female", "group", 0.25), 
        equivalence.F.test(supply.data, "age", "group", 0.25), 
        equivalence.F.test(supply.data, "mid.edu", "group", 0.25), 
        equivalence.F.test(supply.data, "high.edu", "group", 0.25), 
        equivalence.F.test(supply.data, "LDP.supporter", "group", 0.25), 
        equivalence.F.test(supply.data, "independent", "group", 0.25))

## Table A.8
equivalence.F.test.result

#### distribution of the outcome ####
round(mean(supply.data$outcome), 2)
round(mean(supply.data$outcome[supply.data$female == 1]), 2)
round(mean(supply.data$outcome[supply.data$female == 0]), 2)

## Figure A.7
histogram.draw <- function(x, d) {
  prop <- prop.table(table(x))
  for (i in 1:5) {
    polygon(c(0, 0, d * prop[i], d * prop[i]), 
            c(i - 0.5, i + 0.5, i + 0.5, i - 0.5), 
            col = ifelse(d == -1, "gray", "white"))
  }
}

cairo_pdf("Figure_A7_1.pdf", width = 3, height = 3, pointsize = 8)
layout(matrix(1:4, 2, 2, byrow = TRUE))
par(mar = c(2.5, 1, 2, 1), oma = c(0, 0, 2, 0), lwd = 0.5)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext(c("Definitely\napply", "Might\napply", "Neither", 
        "Might\nnot apply", "Definitely\nnot apply"), 
      side = 4, line = 1, at = 5:1, adj = 0.5, las = 1, cex = 0.5)
mtext("Control", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext("Power", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext(c("Definitely\napply", "Might\napply", "Neither", 
        "Might\nnot apply", "Definitely\nnot apply"), 
      side = 4, line = 1, at = 5:1, adj = 0.5, las = 1, cex = 0.5)
mtext("Tenure", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext("Power + Tenure", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
mtext("House of Representatives", line = 0.5, outer = TRUE, font = 2)
dev.off()

cairo_pdf("Figure_A7_2.pdf", width = 3, height = 3, pointsize = 8)
layout(matrix(1:4, 2, 2, byrow = TRUE))
par(mar = c(2.5, 1, 2, 1), oma = c(0, 0, 2, 0), lwd = 0.5)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext(c("Definitely\napply", "Might\napply", "Neither", 
        "Might\nnot apply", "Definitely\nnot apply"), 
      side = 4, line = 1, at = 5:1, adj = 0.5, las = 1, cex = 0.5)
mtext("Control", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext("Power", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext(c("Definitely\napply", "Might\napply", "Neither", 
        "Might\nnot apply", "Definitely\nnot apply"), 
      side = 4, line = 1, at = 5:1, adj = 0.5, las = 1, cex = 0.5)
mtext("Tenure", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.6, 0.6), ylim = c(0.5, 5.5), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = 0, col = "gray80")
abline(v = c(-0.6, -0.4, -0.2, 0.2, 0.4, 0.6), lty = 3, col = "gray80")
histogram.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 0], -1)
histogram.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 1], 1)
axis(1, at = seq(-0.6, 0.6, 0.2), 
     labels = c("0.6", "0.4", "0.2", "0.0", "0.2", "0.4", "0.6"), 
     lwd = 0.5, cex.axis = 0.8)
mtext("Power + Tenure", line = 1, cex = 0.8, font = 2)
mtext(c("Male", "Female"), line = 0, at = c(-0.3, 0.3), cex = 0.6, font = 2)
mtext("House of Councillors", line = 0.5, outer = TRUE, font = 2)
dev.off()

#### main analysis ####
## Table 1
result.male <- lm_robust(outcome ~ HOC * (power + tenure), 
                         data = supply.data, subset = female == 0)
round(summary(result.male)$coefficients[, c(1, 2, 4)], 3)
result.male$nobs

result.female <- lm_robust(outcome ~ HOC * (power + tenure), 
                           data = supply.data, subset = female == 1)
round(summary(result.female)$coefficients[, c(1, 2, 4)], 3)
result.female$nobs

## Figure 4
point.draw <- function(x, y, pch, bg = NA) {
  res <- lm_robust(x ~ 1)
  segments(res$conf.low, y, res$conf.high, y)
  points(res$coefficients, y, pch = pch, bg = bg)
}

cairo_pdf("Figure_4.pdf", width = 5, height = 7, pointsize = 10)
layout(matrix(1:2, 2, 1))
par(mar = c(4, 0, 4, 0), lwd = 0.5)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(0, 2), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 0], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 0], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 0], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 0], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 1], 1, 21, bg = "white")
text(-0.05, 15, "Control", pos = 4, font = 2)
text(-0.05, 11, "Power", pos = 4, font = 2)
text(-0.05, 7, "Tenure", pos = 4, font = 2)
text(-0.05, 3, "Power + Tenure", pos = 4, font = 2)
text(0, seq(2, 14, 4), 
     paste0("Male (N = ", 
            c(sum(supply.data$group == 1 & supply.data$female == 0), 
              sum(supply.data$group == 2 & supply.data$female == 0), 
              sum(supply.data$group == 3 & supply.data$female == 0), 
              sum(supply.data$group == 4 & supply.data$female == 0)), ")"), 
     pos = 4, cex = 0.9)
text(0, seq(1, 13, 4), 
     paste0("Female (N = ", 
            c(sum(supply.data$group == 1 & supply.data$female == 1), 
              sum(supply.data$group == 2 & supply.data$female == 1), 
              sum(supply.data$group == 3 & supply.data$female == 1), 
              sum(supply.data$group == 4 & supply.data$female == 1)), ")"), 
     pos = 4, cex = 0.9)
axis(1, at = seq(0.5, 2, 0.25), lwd = 0.5)
mtext("House of Representatives", at = 1.25, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.25, line = 3)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(0, 2), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 0], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 0], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 0], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 0], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 1], 1, 21, bg = "white")
text(-0.05, 15, "Control", pos = 4, font = 2)
text(-0.05, 11, "Power", pos = 4, font = 2)
text(-0.05, 7, "Tenure", pos = 4, font = 2)
text(-0.05, 3, "Power + Tenure", pos = 4, font = 2)
text(0, seq(2, 14, 4), 
     paste0("Male (N = ", 
            c(sum(supply.data$group == 5 & supply.data$female == 0), 
              sum(supply.data$group == 6 & supply.data$female == 0), 
              sum(supply.data$group == 7 & supply.data$female == 0), 
              sum(supply.data$group == 8 & supply.data$female == 0)), ")"), 
     pos = 4, cex = 0.9)
text(0, seq(1, 13, 4), 
     paste0("Female (N = ", 
            c(sum(supply.data$group == 5 & supply.data$female == 1), 
              sum(supply.data$group == 6 & supply.data$female == 1), 
              sum(supply.data$group == 7 & supply.data$female == 1), 
              sum(supply.data$group == 8 & supply.data$female == 1)), ")"), 
     pos = 4, cex = 0.9)
axis(1, at = seq(0.5, 2, 0.25), lwd = 0.5)
mtext("House of Councillors", at = 1.25, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.25, line = 3)
dev.off()

#### alternative specifications ####
## Table 2
result.without.power <- lm_robust(outcome ~ HOC * female + tenure, 
                                  data = supply.data, subset = power == 0)
round(summary(result.without.power)$coefficients[, c(1, 2, 4)], 3)
result.without.power$nobs

result.with.power <- lm_robust(outcome ~ HOC * female + tenure, 
                               data = supply.data, subset = power == 1)
round(summary(result.with.power)$coefficients[, c(1, 2, 4)], 3)
result.with.power$nobs

result.without.tenure <- lm_robust(outcome ~ HOC * female + power, 
                                   data = supply.data, subset = tenure == 0)
round(summary(result.without.tenure)$coefficients[, c(1, 2, 4)], 3)
result.without.tenure$nobs

result.with.tenure <- lm_robust(outcome ~ HOC * female + power, 
                                data = supply.data, subset = tenure == 1)
round(summary(result.with.tenure)$coefficients[, c(1, 2, 4)], 3)
result.with.tenure$nobs

#### robustness check using a binary outcome ####
supply.data$outcome.bin <- (supply.data$outcome > 2) * 1

## Table A.9
result.male.bin <- lm_robust(outcome.bin ~ HOC * (power + tenure), 
                             data = supply.data, subset = female == 0)
round(summary(result.male.bin)$coefficients[, c(1, 2, 4)], 3)
result.male.bin$nobs

result.female.bin <- lm_robust(outcome.bin ~ HOC * (power + tenure), 
                               data = supply.data, subset = female == 1)
round(summary(result.female.bin)$coefficients[, c(1, 2, 4)], 3)
result.female.bin$nobs

## Figure A.8
cairo_pdf("Figure_A8.pdf", width = 10, height = 3.5, pointsize = 10)
layout(matrix(1:2, 1, 2))
par(mar = c(4, 0, 4, 0), lwd = 0.5)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-1 / 6, 0.5), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0, 0.5, 0.1), lty = 3, col = "gray")
point.draw(supply.data$outcome.bin[supply.data$group == 1 & supply.data$female == 0], 14, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 1 & supply.data$female == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome.bin[supply.data$group == 2 & supply.data$female == 0], 10, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 2 & supply.data$female == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome.bin[supply.data$group == 3 & supply.data$female == 0], 6, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 3 & supply.data$female == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome.bin[supply.data$group == 4 & supply.data$female == 0], 2, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 4 & supply.data$female == 1], 1, 21, bg = "white")
text(-0.18, 15, "Control", pos = 4, font = 2)
text(-0.18, 11, "Power", pos = 4, font = 2)
text(-0.18, 7, "Tenure", pos = 4, font = 2)
text(-0.18, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.15, seq(2, 14, 4), "Male", pos = 4)
text(-0.15, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0, 0.5, 0.1), lwd = 0.5)
mtext("House of Representatives", at = 0.25, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 0.25, line = 3)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-1 / 6, 0.5), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0, 0.5, 0.1), lty = 3, col = "gray")
point.draw(supply.data$outcome.bin[supply.data$group == 5 & supply.data$female == 0], 14, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 5 & supply.data$female == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome.bin[supply.data$group == 6 & supply.data$female == 0], 10, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 6 & supply.data$female == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome.bin[supply.data$group == 7 & supply.data$female == 0], 6, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 7 & supply.data$female == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome.bin[supply.data$group == 8 & supply.data$female == 0], 2, 19)
point.draw(supply.data$outcome.bin[supply.data$group == 8 & supply.data$female == 1], 1, 21, bg = "white")
text(-0.18, 15, "Control", pos = 4, font = 2)
text(-0.18, 11, "Power", pos = 4, font = 2)
text(-0.18, 7, "Tenure", pos = 4, font = 2)
text(-0.18, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.15, seq(2, 14, 4), "Male", pos = 4)
text(-0.15, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0, 0.5, 0.1), lwd = 0.5)
mtext("House of Councillors", at = 0.25, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 0.25, line = 3)
dev.off()

## Table A.10
result.without.power.bin <- lm_robust(outcome.bin ~ HOC * female + tenure, 
                                      data = supply.data, subset = power == 0)
round(summary(result.without.power.bin)$coefficients[, c(1, 2, 4)], 3)
result.without.power.bin$nobs

result.with.power.bin <- lm_robust(outcome.bin ~ HOC * female + tenure, 
                                   data = supply.data, subset = power == 1)
round(summary(result.with.power.bin)$coefficients[, c(1, 2, 4)], 3)
result.with.power.bin$nobs

result.without.tenure.bin <- lm_robust(outcome.bin ~ HOC * female + power, 
                                       data = supply.data, subset = tenure == 0)
round(summary(result.without.tenure.bin)$coefficients[, c(1, 2, 4)], 3)
result.without.tenure.bin$nobs

result.with.tenure.bin <- lm_robust(outcome.bin ~ HOC * female + power, 
                                    data = supply.data, subset = tenure == 1)
round(summary(result.with.tenure.bin)$coefficients[, c(1, 2, 4)], 3)
result.with.tenure.bin$nobs

#### robustness check using the Freedman-Lane permutation test ####
supply.data$power.scaled <- scale(supply.data$power, scale = FALSE)
supply.data$tenure.scaled <- scale(supply.data$tenure, scale = FALSE)

## Table A.11
set.seed(1)
result.male.perm <- aovperm(outcome ~ HOC * (power + tenure), 
                            data = subset(supply.data, female == 0), 
                            np = 10000)
round(result.male.perm$table, 3)

set.seed(2)
result.female.perm <- aovperm(outcome ~ HOC * (power + tenure), 
                              data = subset(supply.data, female == 1), 
                              np = 10000)
round(result.female.perm$table, 3)

## Table A.12
set.seed(3)
result.without.power.perm <- aovperm(outcome ~ HOC * female + tenure.scaled, 
                                     data = subset(supply.data, power == 0), 
                                     np = 10000)
round(result.without.power.perm$table, 3)

set.seed(4)
result.with.power.perm <- aovperm(outcome ~ HOC * female + tenure.scaled, 
                                  data = subset(supply.data, power == 1), 
                                  np = 10000)
round(result.with.power.perm$table, 3)

set.seed(5)
result.without.tenure.perm <- aovperm(outcome ~ HOC * female + power.scaled, 
                                      data = subset(supply.data, tenure == 0), 
                                      np = 10000)
round(result.without.tenure.perm$table, 3)

set.seed(6)
result.with.tenure.perm <- aovperm(outcome ~ HOC * female + power.scaled, 
                                   data = subset(supply.data, tenure == 1), 
                                   np = 10000)
round(result.with.tenure.perm$table, 3)

#### separate analyses by partisanship ####
## Table A.13
result.male.LDP <- lm_robust(outcome ~ HOC * (power + tenure), 
                             data = supply.data, 
                             subset = female == 0 & LDP.supporter == 1)
round(summary(result.male.LDP)$coefficients[, c(1, 2, 4)], 3)
result.male.LDP$nobs

result.female.LDP <- lm_robust(outcome ~ HOC * (power + tenure), 
                               data = supply.data, 
                               subset = female == 1 & LDP.supporter == 1)
round(summary(result.female.LDP)$coefficients[, c(1, 2, 4)], 3)
result.female.LDP$nobs

result.male.other <- lm_robust(outcome ~ HOC * (power + tenure), 
                               data = supply.data, 
                               subset = female == 0 & other.supporter == 1)
round(summary(result.male.other)$coefficients[, c(1, 2, 4)], 3)
result.male.other$nobs

result.female.other <- lm_robust(outcome ~ HOC * (power + tenure), 
                                 data = supply.data, 
                                 subset = female == 1 & other.supporter == 1)
round(summary(result.female.other)$coefficients[, c(1, 2, 4)], 3)
result.female.other$nobs

result.male.independent <- lm_robust(outcome ~ HOC * (power + tenure), 
                                     data = supply.data, 
                                     subset = female == 0 & independent == 1)
round(summary(result.male.independent)$coefficients[, c(1, 2, 4)], 3)
result.male.independent$nobs

result.female.independent <- lm_robust(outcome ~ HOC * (power + tenure), 
                                       data = supply.data, 
                                       subset = female == 1 & independent == 1)
round(summary(result.female.independent)$coefficients[, c(1, 2, 4)], 3)
result.female.independent$nobs

## Figure A.9
cairo_pdf("Figure_A9a.pdf", width = 10, height = 3.5, pointsize = 10)
layout(matrix(1:2, 1, 2))
par(mar = c(4, 0, 4, 0), lwd = 0.5)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.1, 2.25), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2.25, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 1, 21, bg = "white")
text(-0.15, 15, "Control", pos = 4, font = 2)
text(-0.15, 11, "Power", pos = 4, font = 2)
text(-0.15, 7, "Tenure", pos = 4, font = 2)
text(-0.15, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.08, seq(2, 14, 4), "Male", pos = 4)
text(-0.08, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0.5, 2.25, 0.25), lwd = 0.5)
mtext("House of Representatives", at = 1.375, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.375, line = 3)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.1, 2.25), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2.25, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 0 & supply.data$LDP.supporter == 1], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 1 & supply.data$LDP.supporter == 1], 1, 21, bg = "white")
text(-0.15, 15, "Control", pos = 4, font = 2)
text(-0.15, 11, "Power", pos = 4, font = 2)
text(-0.15, 7, "Tenure", pos = 4, font = 2)
text(-0.15, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.08, seq(2, 14, 4), "Male", pos = 4)
text(-0.08, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0.5, 2.25, 0.25), lwd = 0.5)
mtext("House of Councillors", at = 1.375, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.375, line = 3)
dev.off()

cairo_pdf("Figure_A9b.pdf", width = 10, height = 3.5, pointsize = 10)
layout(matrix(1:2, 1, 2))
par(mar = c(4, 0, 4, 0), lwd = 0.5)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.1, 2.25), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2.25, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 0 & supply.data$other.supporter == 1], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 1 & supply.data$other.supporter == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 0 & supply.data$other.supporter == 1], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 1 & supply.data$other.supporter == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 0 & supply.data$other.supporter == 1], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 1 & supply.data$other.supporter == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 0 & supply.data$other.supporter == 1], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 1 & supply.data$other.supporter == 1], 1, 21, bg = "white")
text(-0.15, 15, "Control", pos = 4, font = 2)
text(-0.15, 11, "Power", pos = 4, font = 2)
text(-0.15, 7, "Tenure", pos = 4, font = 2)
text(-0.15, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.08, seq(2, 14, 4), "Male", pos = 4)
text(-0.08, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0.5, 2.25, 0.25), lwd = 0.5)
mtext("House of Representatives", at = 1.375, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.375, line = 3)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.1, 2.25), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2.25, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 0 & supply.data$other.supporter == 1], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 1 & supply.data$other.supporter == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 0 & supply.data$other.supporter == 1], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 1 & supply.data$other.supporter == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 0 & supply.data$other.supporter == 1], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 1 & supply.data$other.supporter == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 0 & supply.data$other.supporter == 1], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 1 & supply.data$other.supporter == 1], 1, 21, bg = "white")
text(-0.15, 15, "Control", pos = 4, font = 2)
text(-0.15, 11, "Power", pos = 4, font = 2)
text(-0.15, 7, "Tenure", pos = 4, font = 2)
text(-0.15, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.08, seq(2, 14, 4), "Male", pos = 4)
text(-0.08, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0.5, 2.25, 0.25), lwd = 0.5)
mtext("House of Councillors", at = 1.375, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.375, line = 3)
dev.off()

cairo_pdf("Figure_A9c.pdf", width = 10, height = 3.5, pointsize = 10)
layout(matrix(1:2, 1, 2))
par(mar = c(4, 0, 4, 0), lwd = 0.5)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.1, 2.25), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2.25, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 0 & supply.data$independent == 1], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 1 & supply.data$female == 1 & supply.data$independent == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 0 & supply.data$independent == 1], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 2 & supply.data$female == 1 & supply.data$independent == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 0 & supply.data$independent == 1], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 3 & supply.data$female == 1 & supply.data$independent == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 0 & supply.data$independent == 1], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 4 & supply.data$female == 1 & supply.data$independent == 1], 1, 21, bg = "white")
text(-0.15, 15, "Control", pos = 4, font = 2)
text(-0.15, 11, "Power", pos = 4, font = 2)
text(-0.15, 7, "Tenure", pos = 4, font = 2)
text(-0.15, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.08, seq(2, 14, 4), "Male", pos = 4)
text(-0.08, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0.5, 2.25, 0.25), lwd = 0.5)
mtext("House of Representatives", at = 1.375, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.375, line = 3)
plot(NULL, NULL, type = "n", bty = "n", xlim = c(-0.1, 2.25), ylim = c(0, 15), 
     xlab = "", ylab = "", xaxt = "n", yaxt = "n")
abline(v = seq(0.5, 2.25, 0.25), lty = 3, col = "gray")
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 0 & supply.data$independent == 1], 14, 19)
point.draw(supply.data$outcome[supply.data$group == 5 & supply.data$female == 1 & supply.data$independent == 1], 13, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 0 & supply.data$independent == 1], 10, 19)
point.draw(supply.data$outcome[supply.data$group == 6 & supply.data$female == 1 & supply.data$independent == 1], 9, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 0 & supply.data$independent == 1], 6, 19)
point.draw(supply.data$outcome[supply.data$group == 7 & supply.data$female == 1 & supply.data$independent == 1], 5, 21, bg = "white")
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 0 & supply.data$independent == 1], 2, 19)
point.draw(supply.data$outcome[supply.data$group == 8 & supply.data$female == 1 & supply.data$independent == 1], 1, 21, bg = "white")
text(-0.15, 15, "Control", pos = 4, font = 2)
text(-0.15, 11, "Power", pos = 4, font = 2)
text(-0.15, 7, "Tenure", pos = 4, font = 2)
text(-0.15, 3, "Power + Tenure", pos = 4, font = 2)
text(-0.08, seq(2, 14, 4), "Male", pos = 4)
text(-0.08, seq(1, 13, 4), "Female", pos = 4)
axis(1, at = seq(0.5, 2.25, 0.25), lwd = 0.5)
mtext("House of Councillors", at = 1.375, line = 1, cex = 1.2, font = 2)
mtext("Ambition to run for office", side = 1, at = 1.375, line = 3)
dev.off()

## Table A.14
result.without.power.LDP <- lm_robust(outcome ~ HOC * female + tenure, 
                                      data = supply.data, 
                                      subset = power == 0 & LDP.supporter == 1)
round(summary(result.without.power.LDP)$coefficients[, c(1, 2, 4)], 3)
result.without.power.LDP$nobs

result.with.power.LDP <- lm_robust(outcome ~ HOC * female + tenure, 
                                   data = supply.data, 
                                   subset = power == 1 & LDP.supporter == 1)
round(summary(result.with.power.LDP)$coefficients[, c(1, 2, 4)], 3)
result.with.power.LDP$nobs

result.without.tenure.LDP <- lm_robust(outcome ~ HOC * female + power, 
                                       data = supply.data, 
                                       subset = tenure == 0 & LDP.supporter == 1)
round(summary(result.without.tenure.LDP)$coefficients[, c(1, 2, 4)], 3)
result.without.tenure.LDP$nobs

result.with.tenure.LDP <- lm_robust(outcome ~ HOC * female + power, 
                                    data = supply.data, 
                                    subset = tenure == 1 & LDP.supporter == 1)
round(summary(result.with.tenure.LDP)$coefficients[, c(1, 2, 4)], 3)
result.with.tenure.LDP$nobs

result.without.power.other <- lm_robust(outcome ~ HOC * female + tenure, 
                                        data = supply.data, 
                                        subset = power == 0 & other.supporter == 1)
round(summary(result.without.power.other)$coefficients[, c(1, 2, 4)], 3)
result.without.power.other$nobs

result.with.power.other <- lm_robust(outcome ~ HOC * female + tenure, 
                                     data = supply.data, 
                                     subset = power == 1 & other.supporter == 1)
round(summary(result.with.power.other)$coefficients[, c(1, 2, 4)], 3)
result.with.power.other$nobs

result.without.tenure.other <- lm_robust(outcome ~ HOC * female + power, 
                                         data = supply.data, 
                                         subset = tenure == 0 & other.supporter == 1)
round(summary(result.without.tenure.other)$coefficients[, c(1, 2, 4)], 3)
result.without.tenure.other$nobs

result.with.tenure.other <- lm_robust(outcome ~ HOC * female + power, 
                                      data = supply.data, 
                                      subset = tenure == 1 & other.supporter == 1)
round(summary(result.with.tenure.other)$coefficients[, c(1, 2, 4)], 3)
result.with.tenure.other$nobs

result.without.power.independent <- lm_robust(outcome ~ HOC * female + tenure, 
                                              data = supply.data, 
                                              subset = power == 0 & independent == 1)
round(summary(result.without.power.independent)$coefficients[, c(1, 2, 4)], 3)
result.without.power.independent$nobs

result.with.power.independent <- lm_robust(outcome ~ HOC * female + tenure, 
                                           data = supply.data, 
                                           subset = power == 1 & independent == 1)
round(summary(result.with.power.independent)$coefficients[, c(1, 2, 4)], 3)
result.with.power.independent$nobs

result.without.tenure.independent <- lm_robust(outcome ~ HOC * female + power, 
                                               data = supply.data, 
                                               subset = tenure == 0 & independent == 1)
round(summary(result.without.tenure.independent)$coefficients[, c(1, 2, 4)], 3)
result.without.tenure.independent$nobs

result.with.tenure.independent <- lm_robust(outcome ~ HOC * female + power, 
                                            data = supply.data, 
                                            subset = tenure == 1 & independent == 1)
round(summary(result.with.tenure.independent)$coefficients[, c(1, 2, 4)], 3)
result.with.tenure.independent$nobs

## three-way interaction
result.male.triple <- lm_robust(outcome ~ HOC * (power + tenure) * 
                                  (other.supporter + independent), 
                                data = supply.data, subset = female == 0)
round(summary(result.male.triple)$coefficients[, c(1, 2, 4)], 3)

result.female.triple <- lm_robust(outcome ~ HOC * (power + tenure) * 
                                    (other.supporter + independent), 
                                  data = supply.data, subset = female == 1)
round(summary(result.female.triple)$coefficients[, c(1, 2, 4)], 3)

result.without.power.triple <- lm_robust(outcome ~ HOC * female * 
                                           (other.supporter + independent) + tenure, 
                                         data = supply.data, subset = power == 0)
round(summary(result.without.power.triple)$coefficients[, c(1, 2, 4)], 3)

result.with.power.triple <- lm_robust(outcome ~ HOC * female * 
                                        (other.supporter + independent) + tenure, 
                                      data = supply.data, subset = power == 1)
round(summary(result.with.power.triple)$coefficients[, c(1, 2, 4)], 3)

result.without.tenure.triple <- lm_robust(outcome ~ HOC * female * 
                                            (other.supporter + independent) + power, 
                                          data = supply.data, subset = tenure == 0)
round(summary(result.without.tenure.triple)$coefficients[, c(1, 2, 4)], 3)

result.with.tenure.triple <- lm_robust(outcome ~ HOC * female * 
                                         (other.supporter + independent) + power, 
                                       data = supply.data, subset = tenure == 1)
round(summary(result.with.tenure.triple)$coefficients[, c(1, 2, 4)], 3)